#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <math.h> 
#include <ctype.h> 
#include <time.h> 
#include <assert.h>

void one(int arr[],int sz)
{
	for (int i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}
	printf("\n");
}

char two(int n)
{
	if (n == 0)
	{
		return 'N';
	}
	for (int i = 2; i <= sqrt(n); i++)
	{
		if (n % i == 0)
		{
			return 'N';
		}
	}
	return 'Y';
}

int three(int n1, int n2)
{
	while (n1 % n2)
	{
		int temp = n1 % n2;
		n1 = n2;
		n2 = temp;
	}
	return n2;
}

int four(int n1, int n2)
{
	return n1 * n2 / three(n1, n2);
}

void five(int arr[],int sz)
{
	for (int i = 0; i < sz - 1; i++)
	{
		for (int j = 0; j < sz - 1 - i; j++)
		{
			if (arr[j] > arr[j + 1])
			{
				int temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;
			}
		}
	}

	for (int i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}
	printf("\n");
}

double six(int arr[], int sz)
{
	double sum = 0;
	for (int i = 0; i < sz; i++)
	{
		sum += arr[i];
	}

	double average = sum / 10;

	double sum1 = 0;
	for (int i = 0; i < sz; i++)
	{
		sum1 += pow(arr[i], 2);
	}

	return (sum1 / sz) - pow(average, 2);
}

void seven(int arr[][3])
{
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}
}

//char* eight(int arr[])
//{
//	char ch[100];
//	
//	for (int i = 0, j = 0; i < 10; j++)
//	{
//		if (i % 2 != 0)
//			ch[j] = '0' + arr[i];
//		else
//			ch[j] = ' ';
//	}
//	return ch;
//}

void nine(int n)
{
	do
	{
		printf("%d", n % 10);
		n /= 10;
	} while (n);
}

int main()
{
	int num[10];
	for (int i = 0; i < 10; i++)
	{
		scanf("%x", &num[i]);
	}
	
	int sz = sizeof(num) / sizeof(num[0]);

	one(num, sz);

	for (int i = 0; i < sz; i++)
	{
		printf("%c ", two(num[i]));
	}

	printf("\n");

	printf("%d\n", three(num[0], num[1]));

	printf("%d\n", four(num[0], num[1]));

	five(num,sz);

	printf("%.2f\n\n", six(num, sz));

	int arr[3][3];
	int k = 0;
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			arr[i][j] = num[k++];
		}
	}
	seven(arr);
	printf("\n");

	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < i; j++)
		{
			int temp = arr[i][j];
			arr[i][j] = arr[j][i];
			arr[j][i] = temp;
		}
	}

	seven(arr);
	printf("\n");

	
	for (int ou = 1, ji = 0; ou < 10 && ji < 9; ou += 2, ji += 2)
	{
		nine(num[ji]);
		nine(num[ou]);
		printf(" ");
	}


	return 0;
}